package com.xhwl.logistics.controller.cent;


import com.xhwl.common.pojo.ResultJson;
import com.xhwl.logistics.entity.logistics.Device;
import com.xhwl.logistics.query.iot.IotDeviceQuery;
import com.xhwl.logistics.service.logistics.DeviceService;
import com.xhwl.logistics.util.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lin.yang
 * @since 2023-12-15
 */
@Api(tags = "设备管理")
@RestController
@RequestMapping("/device")
@Slf4j
public class DeviceController {

    @Autowired
    private DeviceService deviceService;


    @PostMapping(value = "pageDevice")
    @ApiOperation(value = "分页设备列表")
    public ResultJson<PageResult<Device>> pageDevice(@RequestBody IotDeviceQuery query, HttpServletRequest request) {
        log.info("pageDevice() called with parameters => 【query = {}】, 【request = {}】", query, request);
        return this.deviceService.pageDevice(query);
    }
}
